"""
继承：
父类(基类)(超类)：定义类时出现在类名后的括号中
    默认所有类都继承object 可以省略
子类

当调用实例的方法时 先在本身找对应的方法实现   如果找不到 则去父类中找对应的实现

龙生龙 凤生凤  老鼠的儿子会打洞
"""

# 在int类的内部已经实现过__str__
# a = int(10)
# print(a)
#
#
# class Person(object):
#     """
#     当类Person没有编写__str__ 时会直接使用父类(基类)的__str__
#     如果自己定义了__str__ 则使用自己的__str__
#     """
#
#     def __init__(self, name):
#         self.name = name
#
#     def __str__(self):
#         return f"名字： {self.name}"
#
#     def walk(self):
#         print(f"可以走路")
#
#
# p1 = Person("小王")
#
# print(p1)
#
# p1.walk()
#
#
#
# class SuperPerson(Person):
#     """
#     子类 超人
#     """
#
#     def __init__(self, name, skill):
#         super().__init__(name)
#         # self.name = name
#         self.skill = skill
#
#     def __str__(self):
#         """父类已经实现"""
#         return f"{super().__str__()} 技能: {self.skill}"
#
#     def fly(self):
#         print(f"可以飞行")
#
#
# sp1 = SuperPerson("绿巨人", "变身")
# print(sp1)
#
# sp1.walk()
# sp1.fly()


# from datetime import datetime
# class Light(object):
#     def __init__(self):
#         self.enable = False
#
#     def open(self):
#         self.enable = True
#
#     def close(self):
#         self.enable = False
#
#     def is_open(self):
#         return self.enable
#
# class PointLight(Light):
#     def __str__(self):
#         return f"我是点光源"
#
#     def __init__(self, x, y):
#         super().__init__()
#         self.x = x
#         self.y = y
#
#     def pos_show(self):
#         print(f"我在X:{self.x} Y:{self.y}这个位置发光")
# class SpotLight(Light):
#     def __str__(self):
#         return f"我是聚光灯"
#
#     def __init__(self, angle):
#         super().__init__()
#         self.angel = angle
#
#     def angle_show(self):
#         print(f"我是{self.angel}度的聚光灯")
#
# class AreaLight(Light):
#     def __str__(self):
#         return f"我是区域光"
#
# class DirectionLight(Light):
#     def __str__(self):
#         return f"我是太阳光"
#
#     def rotate_show(self):
#         now = datetime.now()
#         print(f"我是{now.hour}点钟的太阳")
#
#
# pl = PointLight(100, 100)
# sl = SpotLight(30)
# al = AreaLight()
# dl = DirectionLight()
# print(pl, sl, al, dl)
# print(pl.is_open(), sl.is_open(), al.is_open(), dl.is_open())
#
# dl.open()
# al.open()
# sl.open()
# pl.open()
#
# print(pl.is_open(), sl.is_open(), al.is_open(), dl.is_open())
#
# dl.rotate_show()
# sl.angle_show()
# pl.pos_show()


# class A000:
#     pass
#
#
# class A00(A000):
#     pass
#
#     def __str__(self):
#         return "A000"
#
#
# class A0(A00):
#     pass
#
#
# class A1:
#     pass
#
#
# class A(A0, A1):
#     pass
#
#
# # print(A.__name__, A.__base__)
#
# class B0:
#     pass
#
#
# class B(B0):
#     pass
#
#
# class D:
#     pass
#
#     def __str__(self):
#         return "D"
#
#
# class C(A, B, D):
#     pass
#
#
# print(C.__base__)
#
# c = C()
# print(c)  # __str__
# #  当访问c中__str__ 没有定义 则去父类 A中找  A中也没有  则去A的父类object中找
# print(C.mro())  # method   retrieval  order
#


import tkinter

root = tkinter.Tk()
#
# lable = tkinter.Label(text="多继承")
# print(tkinter.Label.mro())
#
# # lable.pack()
# # lable.pack_configure()
#
# # lable.place(x=50, y=50)
# # lable.place_configure(x=50, y=50)
#
# lable.grid(row=1, column=1)
# lable2 = tkinter.Label(text="多继承")
# lable2.grid(row=2, column=2)
# lable3 = tkinter.Label(text="多继承")
# lable3.grid(row=3, column=3)
#
#
#
# root.mainloop()
